/**
 * Auto gen via dbpojo-gen.
 */
package com.us.usws.site.console.action;

import java.util.List;

import javax.inject.Inject;

import org.apache.commons.lang3.StringUtils;

import com.us.usws.model.domain.base.BaseVideoTypeExtattr;
import com.us.usws.service.cud.BaseVideoTypeExtattrCUDService;
import com.us.usws.service.ro.BaseVideoTypeExtattrROService;
import com.us.usws.support.uitls.JSONDataUtil;

/**
 * Struts2 action
 * @author robot
 */
public class BaseVideoTypeExtattrAction extends BasePageSearchAction< BaseVideoTypeExtattr> {

	private static final long serialVersionUID = 1L;

	private BaseVideoTypeExtattr baseVideoTypeExtattr;

	@Inject
	private BaseVideoTypeExtattrROService baseVideoTypeExtattrROService;

	@Inject
	private BaseVideoTypeExtattrCUDService baseVideoTypeExtattrCUDService;

	private String uids;

	/**
	 * ajax load the list of BaseVideoTypeExtattr
	 */
	public void ajaxLoadBaseVideoTypeExtattrs() {
		createDataPageUtil();
		List<BaseVideoTypeExtattr> baseVideoTypeExtattrs = baseVideoTypeExtattrROService.getBaseVideoTypeExtattrs(getStart(), getLimit());
		getOut().println(JSONDataUtil.extJsonSupportPage(baseVideoTypeExtattrs, dataPageUtil.getRowCount()));
	}

	/**
	 * ajax update BaseVideoTypeExtattr
	 */
	public void ajaxUpdateBaseVideoTypeExtattr() {
		if (baseVideoTypeExtattr != null) {
			String uid = baseVideoTypeExtattr.getUid();
			if (StringUtils.isNotBlank(uid)) {
				baseVideoTypeExtattrCUDService.updateBaseVideoTypeExtattr(baseVideoTypeExtattr);
			} else {
				baseVideoTypeExtattrCUDService.addBaseVideoTypeExtattr(baseVideoTypeExtattr);
			}
			getOut().print(true);
		} else {
			getOut().print(false);
		}
	}

	/**
	 * ajax delete user.
	 */
	public void ajaxDeleteBaseVideoTypeExtattr() {
		baseVideoTypeExtattrCUDService.deleteBaseVideoTypeExtattrMore(uids);
	}

	public void setBaseVideoTypeExtattr(BaseVideoTypeExtattr baseVideoTypeExtattr) {
		this.baseVideoTypeExtattr = baseVideoTypeExtattr;
	}

	public BaseVideoTypeExtattr getBaseVideoTypeExtattr() {
		return baseVideoTypeExtattr;
	}

	public String getUids() {
		return uids;
	}

	public void setUids(String uids) {
		this.uids = uids;
	}

}